home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
B-Business
/
(c)b2.d64
/
temp convert.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
3KB
|
132 lines
100 REM***WEATHERMAN***
110 REM***WRITTEN BY GLENN PRESCOTT***
120 REM***REVISED BY ED MARCHESCHI*** **C64 CHANGES 3/1/83 BY WIM***
130 POKE53280,1:POKE53281,1:PRINT"[144][147]***WEATHERMAN***"
140 PRINT:PRINT
150 PRINT"SELECT THE PORTION OF THE PROGRAM YOU WANT:"
160 PRINTTAB(4)"1. TEMPERATURE CONVERSION"
170 PRINTTAB(4)"2. TEMPERATURE HUMIDITY INDEX"
180 PRINTTAB(4)"3. WIND CHILL EQUIVALENT TEMPERATURE"
190 PRINTTAB(4)"[145]4. RELATIVE HUMIDITY AND DEW POINT"
200 PRINT:PRINT"ENTER YOUR SELECTION--"
210 INPUTS
220 PRINT:PRINT
230 ONSGOTO240,580,730,850
240 PRINT"[147]**TEMPERATURE CONVERSION**":PRINT
250 PRINT"INPUT TEMPERATURE AND SCALE SEPARATED BY A COMMA."
260 PRINT"LET C=CELSIUS"
270 PRINT" F=FAHRENHEIT"
280 PRINT" K=KELVIN"
290 PRINT" R=RANKINE"
300 PRINT"FOR EXAMPLE: 30,C OR 45,F"
310 PRINT:PRINT"ENTER TEMPATURE,SCALE--"
320 INPUTT,S$
330 IFS$<>"C"GOTO380
340 T1=T
350 T2=(9/5)*T+32
360 T3=T+273.15
370 T4=(9/5)*T3:GOTO510
380 IFS$<>"F"GOTO420
390 T2=T
400 T1=(5/9)*(T-32)
410 T=T1:GOTO360
420 IFS$<>"K"GOTO470
430 T3=T
440 T4=(9/5)*T
450 T2=T4-459.67
460 T1=(5/9)*(T2-32):GOTO510
470 IFS$<>"R"GOTO500
480 T3=(5/9)*T
490 T4=T:GOTO450
500 PRINT"INPUT ERROR, TRY AGAIN--":GOTO250
510 PRINT" ";T1;"DEGREES CELSIUS"
520 PRINT" ";T2;"DEGREES FAHRENHEIT"
530 PRINT" ";T3;"DEGREES KELVIN"
540 PRINT" ";T4;"DEGREES RANKINE":PRINT
550 PRINT"TRY AGAIN ? (Y OR N)":INPUTA$
560 IFA$="Y"GOTO310
570 IFA$="N"GOTO1380
580 PRINT"[147] **TEMPERATURE HUMIDITY INDEX**":PRINT
590 PRINT"INPUT DRY BULB,WET BULB TEMPS IN FAHRENHEIT DEGREES--"
600 PRINT"ENTER TEMP(DRY),TEMP(WET)"
610 INPUTD,W
620 C=0.4*(D+W)+15:PRINT
630 REM***T.H.I.=TEMPERATURE HUMIDITY INDEX***
640 PRINT"T.H.I.=";C
650 IFC>60GOTO670
660 PRINT"(BELOW COMFORT REGION)":GOTO700
670 IFC>70GOTO680:PRINT"(IN COMFORT REGION)":GOTO700
680 IFC>=80GOTO690:PRINT"(MARGINAL COMFORT REGION)":GOTO700
690 PRINT"(UNCOMFORTABLE REGION)":PRINT"(BEWARE OF HEAT EXHAUSTION)"
700 PRINT:PRINT"TRY AGAIN ? (Y OR N)":INPUTA$
710 IFA$="Y"GOTO600
720 IFA$="N"GOTO1380
730 PRINT"[147] **WIND CHILL EQUIVALENT TEMP**"
740 PRINT
750 PRINT"INPUT TEMP IN FAHRENHEIT DEGREES, AND WIND VELOCITY IN MPH"
760 INPUTD,U
770 U9=U/2.23694
780 D9=5/9*(D-32)
790 Q=33-(10.45+10*SQR(U9)-U9)*(33-D9)/22.034
800 Q=9/5*Q+32:PRINT
810 PRINT"EQUIVALENT WIND CHILL TEMP=";Q;"DEGREES":PRINT
820 PRINT"TRY AGAIN ? (Y OR N)":INPUTA$
830 IFA$="Y"GOTO750
840 IFA$="N"GOTO1380
850 PRINT"[147] **RELATIVE HUMIDITY & DEW POINT**"
860 PRINT
870 PRINT"INPUT DRY BULB,WET BULB TEMPS IN FAHRENHEIT DEGREES"
880 PRINT"ENTER TEMP(DRY),TEMP(WET)"
890 INPUTD1,W1:PRINT
900 PRINT"USE STANDARD A TM PRESSURE ? (Y OR N)"
910 INPUTA$
920 IFA$="Y"GOTO970
930 PRINT"ENTER A TM PRESSURE,SCALE (M=MILLIBARS, I=INCHES OF MERCURY)"
940 INPUTA,H$
950 IFH$="M"GOTO980
960 A=A/0.750062:GOTO980
970 A=1013.26
980 S=373.16
990 I=273.16
1000 T=D1
1010 GOSUB1240
1020 D2=T2:E1=E:T=W1
1030 GOSUB1240
1040 W2=T2:E2=E
1050 E3=A*(D2-W2)*(.00066*(1+.00115*W2))
1060 H=100*(E2-E3)/E1:P=E2-E3:T=D1
1070 GOSUB1240
1080 IFE=PGOTO1120
1090 T=T-0.1
1100 GOSUB1240
1110 IFE>PGOTO1090
1120 N9=INT(T):N5=T-N9
1130 IFN5>=0.5GOTO1150
1140 T=N9:GOTO1160
1150 T=INT(T+0.5)
1160 PRINT:PRINT
1170 PRINT" TEMP(DRY)=";D1
1180 PRINT" TEMP(WET)=";W1
1190 PRINT"TEMP DEW POINT=";T
1200 PRINT" REL HUMIDITY=";H:PRINT
1210 PRINT"TRY AGAIN ? (Y OR N)":INPUTA$
1220 IFA$="Y"GOTO860
1230 IFA$="N"GOTO1380
1240 T2=5/9*(T-32):T3=T2+273.15
1250 IFT<=32GOTO1320
1260 V=-7.90298*(S/T3-1)
1270 W=5.02808*LOG(S/T3)
1280 X=-.00000013816*(10^(11.344*(1-T3/S))-1)
1290 Y=.0081328*(10^(-3.49149*(S/T3-1))-1)
1300 E9=V+W+X+Y+3.0057209
1310 E=10^(E9):RETURN
1320 V=-9.09718*(I/T3-1)
1330 W=-3.56654*LOG(I/T3)
1340 X=.876793*(1-T3/I)
1350 E9=V+W+X+.785835
1360 E=10^(E9)
1370 RETURN
1380 PRINT"NEW SELECTION ? (Y OR N)":INPUTA$
1390 IFA$="Y"GOTO130
1400 END